/**
**************************************************************************************
*Founder Effect                                                                      *
*Copyright (C) 2006-2007, 5d Studios (www.5d-Studios.com)                            *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library is distributed in the hope that it will be useful,                     *
*but WITHOUT ANY WARRANTY; without even the implied warranty of                      *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
#pragma once
#include "IGameStateView.h"
#include "SceneManager.h"
#include "WeatherView.h"
#include "ParticleManager.h"

#include "../game/Hud.h"

class InGameState;

/**
==========================================================
Map Change command
==========================================================
*/
class InGameStateView;
class MapChange_f : public ICommand
{
public:
    MapChange_f() { sceneMng = NULL; };
    void Exec(std::string &s);
    ~MapChange_f() {};
    InGameStateView* sceneMng;

    /** Make a critical section */
    struct MapLoadData
    {
        bool IsLoading;
        bool IsLoaded;
        std::string nextMap;
        /** Load a scene */
        int LoadScene( void *s );
        Scene*  currentScene;
    };
    MapLoadData m_mapLoadData;
};
/**
=========================================
In Game State View - Draw the map, characters
=========================================
*/
class InGameStateView : public IGameStateView
{
public:
    InGameStateView(void);
    /** Register the ingame state */
    void RegisterState( IGameState* g );
    /** Render this view */
    void Render( IRender *r, ICamera* cam );

    /** Get the current scene */
    Scene* GetCurrentScene() { return m_sceneMng.GetCurrentScene(); };
    /** Load a map */
    void LoadScene(const std::string &mapfile);

private:
    // scene management
    SceneManager    m_sceneMng;
    // players HUD
    HUD             m_playerHUD;
    // Weather module
    WeatherView     m_weatherView;

    // friend of InGameState
    InGameState*    m_inGameState;

    // particle manager
    ParticleManager m_partMng;
    // Map change cmd
    MapChange_f     map_f;
public:
    virtual ~InGameStateView(void);
};
